package com.sharp.portal.constant.anno;

import java.lang.annotation.*;

/**
 * Title: PortalModel
 * Description: Copyright: Copyright (c) 2019 Company: BHFAE
 *
 * @author Sharp
 * @date 2020/11/5 14:47
 */
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface PortalField {
    /**
     * 只读
     */
    boolean readOnly() default false;

    /**
     * 只写
     */
    boolean writeOnly() default false;

    DataType dataType() default DataType.DEFAULT;

    /**
     * 关联字典名
     */
    String reference() default "BOOLEAN_DICT";

    /**
     * 必填字段
     */
    boolean required() default false;

    /**
     * 是否隐藏
     */
    boolean hidden() default false;

    enum DataType {
        /**
         * 字段类型对应页面组件
         * String   - el-input
         * Boolean  - el-switch
         * Number   - el-input-number
         * Enum     - el-select
         * Tree     - el-cascader
         * Date     - el-date-picker type = date
         * DateTime - el-date-picker type = datetime
         * Link     - el-upload
         * Html     - v-html
         * Text     - el-textArea
         * Default  - depend on the field java type
         */
        STRING,
        BOOLEAN,
        NUMBER,
        ENUM,
        TREE,
        DATE,
        DATETIME,
        LINK,
        HTML,
        TEXT,
        DEFAULT
    }
}
